home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Workspace / Locus / Source / CustomApp.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  99 lines

  1.  
  2. /*
  3.     Copyright 1993  Jeremy Slade.
  4.  
  5.     You are free to use all or any parts of the Locus project
  6.     however you wish, just give credit where credit is due.
  7.     The author (Jeremy Slade) shall not be held responsible
  8.     for any damages that result out of use or misuse of any
  9.     part of this project.
  10.  
  11. */
  12.  
  13. /*
  14.     Project: Locus
  15.  
  16.     File: CustomApp.m
  17.  
  18.     Description: See CustomApp.h
  19.  
  20.     Original Author: Jeremy Slade
  21.  
  22.     Revision History:
  23.         Created
  24.             V.101    JGS    Sat Mar 27 19:09:26 GMT-0700 1993
  25.  
  26. */
  27.  
  28.  
  29. #import "CustomApp.h"
  30.  
  31. #import "Globals.h"
  32.  
  33.  
  34.  
  35. @implementation CustomApp : Application
  36.  
  37.  
  38. // -------------------------------------------------------------------------
  39. //   Creating, Initializing
  40. // -------------------------------------------------------------------------
  41.  
  42.  
  43. + initialize
  44. {
  45.     [self setVersion:CustomApp_VERSION];
  46.     return ( self );
  47. }
  48.  
  49.  
  50.  
  51. // -------------------------------------------------------------------------
  52. //   Events
  53. // -------------------------------------------------------------------------
  54.  
  55.  
  56. - sendEvent:(NXEvent *)theEvent
  57. /*
  58.     This method overrides Application's normal behavior so that all command key events (keydown w/ NX_COMMANDMASK) go first to the KeyWindow, so that responders there get a chance to intercept them before they get to the menus.
  59. */
  60. {
  61.     if ( theEvent->type == NX_KEYDOWN && theEvent->flags
  62.             & NX_COMMANDMASK ) {
  63.         if ( [keyWindow commandKey:theEvent] )
  64.             return ( self ); // The keywindow handled this event
  65.         if ( mainWindow != keyWindow && [mainWindow commandKey:theEvent] )
  66.             return ( self ); // The MainWindow handled this event
  67.     }
  68.     return ( [super sendEvent:theEvent] );
  69. }
  70.  
  71.  
  72.  
  73.  
  74. // -------------------------------------------------------------------------
  75. //   Debugging Support
  76. // -------------------------------------------------------------------------
  77.  
  78.  
  79. - (const char *)appName
  80. /*
  81.     This method appends ".debug" to the appName if the DEBUGGING global is turned on, otherwise behaves as normal.  This is used to have Locus writes defaults under a different owner when running in test mode
  82. */ 
  83. {
  84.     static char *debugName = NULL;
  85.     
  86.     if ( !debugName ) {
  87.         char buf[60];
  88.         sprintf ( buf, "%s.debug", [super appName] );
  89.         debugName = NXCopyStringBuffer ( buf );
  90.     }
  91.     
  92.     return ( DEBUGGING ? debugName : [super appName] );
  93. }
  94.  
  95.  
  96.  
  97. @end
  98.  
  99.